<?php
//Reserved words for entity processing
//entity
//filter
//create
//update
//delete
//params
//count

require("utils.php");
require("entityReader.php");
require("presentation/page/pageReader.php");

function isCloseTag($item, $tag){
	if($item['tag'] == $tag && $item['type'] == 'close'){
		return true;
	}else{
		return false;
	}
}

function isCompleteTag($item, $tag){
	if($item['tag'] == $tag && $item['type'] == 'complete'){
		return true;
	}else{
		return false;
	}
}

function isOpenTag($item, $tag){
	if($item['tag'] == $tag && $item['type'] == 'open'){
		return true;
	}else{
		return false;
	}
}

function isOpenCompleteTag($item, $tag){
	if(isOpenTag($item, $tag) || isCompleteTag($item, $tag)){
		return true;
	}else{
		return false;
	}
}

function readXML($xml){
	xml_parse_into_struct($xml_parser, $xml, $vals, $index);
	xml_parser_free($xml_parser);
	
	return $vals;
}

function read($file){
	
	$xml_parser = xml_parser_create();
	
	if (!($fp = fopen($file, "r"))) {
    	die("could not open XML input");
	}

	$data = stream_get_contents($fp);
	fclose($fp);
	
	xml_parse_into_struct($xml_parser, $data, $vals, $index);
	xml_parser_free($xml_parser);
	
	return $vals;
}

?>